#!/bin/sh
# usage repo_sync.sh {init}
#

MYPATH=$(dirname $(realpath $0))
REPO=${MYPATH}/scripts/repo.python2

# For official repo
# BRANCH=android-7.1.2_r36
# INIT_URL="git://github.com/aosp-mirror/platform_manifest"
# INIT_URL="git://mirrors.ustc.edu.cn/aosp/platform/manifest"

BRANCH=android-7.1.2
INIT_URL="https://gitee.com/anbox/platform_manifests.git"

# Default repo url using mirrors in China
REPO_URL="https://mirrors.tuna.tsinghua.edu.cn/git/git-repo"

export REPO_URL
  
case $1 in
  init)
    $REPO init -u $INIT_URL --depth 1 -b $BRANCH
    ;;
  list)
    REPO_PATH=$(realpath $REPO)
    echo "Checking $REPO_PATH..."
    $REPO list
    ;;
  *|sync)
    $REPO sync -c --no-tags --no-clone-bundle
    ;;
esac

